package com.one.group.user.controller;

import com.one.group.model.entity.SpCell;

import com.one.group.result.Result;
import com.one.group.user.service.CellCacheService;
import com.one.group.utils.ResultUtil;
import com.one.group.user.service.impl.CellServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/cell")
@Tag(name = "小区相关接口")
@Slf4j
public class CellController {
    @Autowired
    private CellCacheService cellCacheService;
    @Autowired
    private CellServiceImpl cellService;

    @GetMapping("/getAllCell")
    @Operation(summary = "查询所有小区信息")
    public Result<List<SpCell>> findAllCell() {
        List<SpCell> cellList = cellCacheService.findAllCell();
        return ResultUtil.success(cellList);

    }
    //查询所有小区
    @GetMapping("/queryAll")
    @Operation(summary = "查询所有小区")
    public Result queryAll() {
        return cellService.queryAll();
    }
    @GetMapping("/queryById")
    @Operation(summary = "根据id查询小区")
    public Result queryById(Long id) {
        return cellService.queryById(id);
    }

}
